<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>滚轮事件</title>
</head>
<body>


<script src="js/jquery-1.8.3.min.js" type="text/javascript"></script>
<script>
    /*IE注册事件*/
    if (document.attachEvent) {
        document.attachEvent('onmousewheel', scrollFunc);
    }
    /*Firefox注册事件*/
    if (document.addEventListener) {
        document.addEventListener('DOMMouseScroll', scrollFunc, false);
    }
    /*注册事件*/
    if (document.addEventListener) {
        document.addEventListener('DOMMouseScroll', scrollFunc, false);
    }//W3C
    window.onmousewheel = document.onmousewheel = scrollFunc;//IE/Opera/Chrome

    function scrollFunc(e) {
        e = e || window.event;
        if (e.wheelDelta) {
            //IE/Opera/Chrome，向下滚动小于0，向上滚动大于0
            console.log(e.wheelDelta);
        } else if (e.detail) {
            //Firefox,向下滚动大于0，向上滚动小于0
            console.log(e.detail);
        }
    }
</script>

</body>
</html>